<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<script type="text/javascript">
function deleteTerms( terms_no ) {
	var msg = "정말 삭제하시겠습니까?";
	if ( confirm(msg) != 0 ) {
		$.ajax({
	        type: "post",
	        url: "./deleteTerms.ga",
	        dataType: "html",
	        data: { terms_no: terms_no },
	        success: function( data ) {
	        	if ( data > 0 ) {
	        		alert("삭제되었습니다.");
	        		location.href="./termsList.ga";
	        	} else {
	        		alert("알수없는 오류로 삭제처리에 실패하였습니다. 다시 시도해 주십시오.");
	        	}
	        },
	        error: function() {
	            alert("오류");
	        }
	    });
	}
}
</script>

</head>
<body>

<h2>약관 내용 보기</h2>

&nbsp; 등록일: &nbsp; ${termsClass.regdate }
<br/><br/>

&nbsp; 항목: &nbsp;
<c:if test="${termsClass.terms_type == 0 }">
    개인보호정책
</c:if>
<c:if test="${termsClass.terms_type == 1 }">
    서비스 이용 약관
</c:if>

<br/><br/>

&nbsp; 제목: &nbsp; <input type="text" name="subject" value="${termsClass.subject }" style="width:60%" readonly/>
<br/><br/><br/>

&nbsp; 내용
<br/>
<textarea name="content" rows="20" cols="100" style="resize:none;width:100%;" readonly>${termsClass.content }</textarea>
&nbsp; 변경 내용 한줄 요약
<br/>
<textarea name="summary" rows="3" cols="100" style="resize:none;width:100%" readonly>${termsClass.summary }</textarea>

<table width="100%">
    <tr>
        <td>
            <input type="button" value="목록보기" style="width:100px;height:30px;"
                onclick="location.href='./termsList.ga'"
            />
        </td>
        <td align="right">
            <input type="button" value="삭제하기" style="width:100px;height:30px;"
                onclick="deleteTerms( ${termsClass.terms_no } )"
            />
            <input type="button" value="수정하기" style="width:100px;height:30px;"
            	onclick="location.href='./modifyTermsForm.ga?terms_no=${termsClass.terms_no }'"
            />
        </td>
    </tr>
</table>

</body>
</html>